{extend name="public/base" /}

{block name="title"}<title>{if condition="$data"}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>配置字段信息</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 配置字段信息</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">{$Think.lang.base_param}</a></li>
                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"><i class="fa fa-list"></i> {$Think.lang.back}</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab1">
                            <input type="hidden" name="id" value="{$data.id}" />
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.k}</label>
                                <div class="col-sm-7"><input class="form-control" name="k" value="{$data.k}" placeholder="{$Think.lang.k}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.v}</label>
                                <div class="col-sm-7"><input class="form-control" name="v" value="{$data.v}" placeholder="{$Think.lang.v}"></div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">分组(英文)</label>
                                <div class="col-sm-7">
                                	<div class="input-group">
	                                	<div class="input-group-btn">
						                  	<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
						                    	选择分组<span class="fa fa-caret-down"></span>
						                  	</button>
						                  	<ul class="dropdown-menu" id="groupList">
						                  		{volist name="groupList" id="vo"}
						                  		    <li><a>{$vo}</a></li>
							                    {/volist}
						                  	</ul>
						                </div>
	                                	<input class="form-control" id="groupList_input" name="type" value="{$data.type}" placeholder="{$Think.lang.type}">
                                	</div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.desc}</label>
                                <div class="col-sm-7"><input class="form-control" name="desc" value="{$data.desc}" placeholder="{$Think.lang.desc}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.prompt}</label>
                                <div class="col-sm-7"><input class="form-control" name="prompt" value="{$data.prompt}" placeholder="{$Think.lang.prompt}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.sorts}</label>
                                <div class="col-sm-7"><input class="form-control" name="sorts" value="{$data.sorts|default='50'}" placeholder="{$Think.lang.sorts}"></div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">表单类型</label>
                                <div class="col-sm-7">
                                    <select class="form-control select2 lb_type" name="texttype" style="width:100%;">
                                    	{foreach name="typeList" item="vo"}
                                        	<option value="{$key}" {if condition="$data.texttype eq $key "}selected="selected"{/if} >{$vo}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group" style="display:none;" id="textlist">
                                <label class="col-sm-2 control-label">列表数据</label>
                                <div class="col-sm-7">
                                	<textarea class="form-control" name="textvalue" rows="5" placeholder="key1|value1
key2|value2">{$textvalue}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.status}</label>
                                <div class="col-sm-7">
                                    <select class="form-control select2" name="status" style="width:100%;">
                                        <option value="1" {if condition="$data.status eq '1'"}selected="selected"{/if} >{$Think.lang.status1}</option>
                                        <option value="0" {if condition="$data.status eq '0'"}selected="selected"{/if} >{$Think.lang.status0}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>
                            </div>
                            <div class="btn-group pull-left">
                                <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });

    /*ajax页面加载icheck，有该控件的页面才需要*/
//  $(".select2").select2({language:"zh-CN"});

    $('.lb_type').on('change',function(){
    	var thisval = $(this).val();
    	if( thisval == 'select' || thisval == 'checkbox' || thisval == 'radio' ){
    		$('#textlist').show();
    	}else{
    		$('#textlist').hide();
    	}
    })
    var lbvalue =  $('.lb_type').val();
	if( lbvalue == 'select' || lbvalue == 'checkbox' || lbvalue == 'radio' ){
		$('#textlist').show();
	}else{
		$('#textlist').hide();
	}

    $('#groupList').on('click','li',function(){
    	var texts = $(this).text();
    	$('#groupList_input').val(texts);
    })

    {if condition=" $rest_login == 1 "}
    	restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}